home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
G-Games
/
(c)gb.d64
/
switch.d
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
6KB
|
173 lines
1 REM- 'CHECKERS SWITCH' FOR COMMODORE 64
2 REM- DANIEL MILLER
3 REM- 2815 34 STREET
4 REM- ASTORIA, QUEENS
5 REM- NEW YORK, NEW YORK 11103
6 REMMARCH 30,1983
7 REM************************************
20 DIM B(45),C(45),A$(4),ER$(6)
30 GOSUB10000:GOTO1005
35 REM- SOUND ROUTINE
40 POKEVO,15:POKEWV,17:POKEAT,15:POKEHI,68:POKELO,149
50 FOR TM=1 TO 100:NEXT TM:POKEWV,0
55 POKEVO,15:POKEWV,17:POKEAT,15:POKEHI,34:POKELO,75
60 FOR TM=1 TO 100:NEXT TM:POKEWV,0:RETURN
300 REM- PUZZLE SCREEN
302 PRINT CHR$(19);TAB(13);HDG$;
303 X=49:FOR Y=1153 TO 1179 STEP3:POKEY,X:X=X+1:NEXT Y
305 PRINT LEFT$(DO$,4)
310 PRINTTAB(8)A$(B(1))UP$A$(B(2))UP$A$(B(3))UP$A$(B(4))UP$A$(B(5))UP$;
315 PRINTTAB(21)A$(B(6))UP$A$(B(7))UP$A$(B(8))UP$A$(B(9))
317 IF VAL(F2$)<>1 THEN320
318 GOSUB40
320 PRINTTAB(8)A$(B(10))UP$A$(B(11))UP$A$(B(12))UP$A$(B(13))UP$A$(B(14))UP$;
325 PRINTTAB(21)A$(B(15))UP$A$(B(16))UP$A$(B(17))UP$A$(B(18))
327 IF VAL(F2$)<>2 THEN330
328 GOSUB40
330 PRINTTAB(8)A$(B(19))UP$A$(B(20))UP$A$(B(21))UP$A$(B(22))UP$A$(B(23))UP$;
335 PRINTTAB(21)A$(B(24))UP$A$(B(25))UP$A$(B(26))UP$A$(B(27))
337 IF VAL(F2$)<>3 THEN340
338 GOSUB40
340 PRINTTAB(8)A$(B(28))UP$A$(B(29))UP$A$(B(30))UP$A$(B(31))UP$A$(B(32))UP$;
345 PRINTTAB(21)A$(B(33))UP$A$(B(34))UP$A$(B(35))UP$A$(B(36))
347 IF VAL(F2$)<>4 THEN350
348 GOSUB40
350 PRINTTAB(8)A$(B(37))UP$A$(B(38))UP$A$(B(39))UP$A$(B(40))UP$A$(B(41))UP$;
355 PRINTTAB(21)A$(B(42))UP$A$(B(43))UP$A$(B(44))UP$A$(B(45))
357 IF VAL(F2$)<>5 THEN410
358 GOSUB40
410 X=49:FOR Y=1230 TO 1750 STEP120:POKEY,X:X=X+1:NEXT Y
420 PRINTLEFT$(DO$,22);TAB(18);MV$;
430 PRINTLEFT$(DO$,24);TAB(12);F3$;TAB(27);T3$;
439 REM- PUZZLE SOLVED ?
440 IF D$=E$ THEN650
500 IF ZZ=1 THEN FOR TM=1 TO 2000:NEXT TM:RETURN
510 REM- MOVE ROUTINE
515 PRINTLEFT$(DO$,24);TAB(20)" ";TAB(31)" ";
520 PRINTLEFT$(DO$,24);TAB(20)" ";LEFT$(DO$,24);TAB(20)CR$;
522 GET F$:IF F$="" THEN522
525 GET G$:IF G$="" THEN525
528 FR$=F$+G$:PRINTFR$;:F$="":G$=""
529 IF FR$="99" THEN8310
532 IF LEFT$(FR$,1)<"1" OR LEFT$(FR$,1)>"5" THEN FR$="":GOTO520
533 IF RIGHT$(FR$,1)<"1" OR RIGHT$(FR$,1)>"9" THEN FR$="":GOTO520
535 H=VAL(FR$):GOSUB8000:FR=H:C(FR)=VAL(MID$(D$,FR,1))
540 PRINTLEFT$(DO$,24);TAB(31);" ";LEFT$(DO$,24);TAB(32)CR$;
542 GET F$:IF F$="" THEN542
545 GET G$:IF G$="" THEN545
548 TU$=F$+G$:PRINT TU$;:F$="":G$=""
550 IF LEFT$(TU$,1)<"1" OR LEFT$(TU$,1)>"5" THEN TU$="":GOTO540
553 IF RIGHT$(TU$,1)<"1" OR RIGHT$(TU$,1)>"9" THEN TU$="":GOTO540
555 H=VAL(TU$):GOSUB8000:TU=H:C(TU)=VAL(MID$(D$,TU,1))
558 Z1=VAL(LEFT$(FR$,1)):Z2=VAL(RIGHT$(FR$,1))
560 Z3=VAL(LEFT$(TU$,1)):Z4=VAL(RIGHT$(TU$,1))
565 F2$=LEFT$(FR$,1)
570 FR$=MID$(D$,FR,1):TU$=MID$(D$,TU,1)
580 IF FR$="4" THEN ER=1:GOTO900
581 IF TU$="1" OR TU$="2" THEN ER=2:GOTO900
582 IF FR$="3" OR TU$="3" THEN ER=3:GOTO900
584 IF Z1=Z3 OR Z2=Z4 THEN ER=4:GOTO900
590 C=C(TU):C(TU)=C(FR):C(FR)=C
600 D$="":FOR X=1 TO 45:D$=D$+RIGHT$(STR$(C(X)),1):NEXT X
610 PRINTLEFT$(DO$,24);TAB(20)" ";TAB(31)" ";
620 FOR X=1 TO 45:B(X)=VAL(MID$(D$,X,1)):NEXT X
630 MV=MV+1:MO$=RV$+WH$+STR$(MV)+RO$:PRINTLEFT$(DO$,22);TAB(25);MO$;:GOTO302
650 FOR X=1 TO 5
652 PRINTLEFT$(DO$,24);TAB(8);WIN$;:FOR TM=1 TO 500:NEXT TM
654 PRINT LEFT$(DO$,24);TAB(8);ER$(0);:FOR TM=1 TO 500:NEXT TM:NEXT X
656 GOTO8310
899 REM- FLASH ERROR MESSAGES
900 F2$="":FOR X=1 TO 5
910 PRINTLEFT$(DO$,25);TAB(22-(LEN(ER$(ER))/2));ER$(ER);:FOR TM=1 TO 500:NEXT TM
920 PRINTLEFT$(DO$,25);TAB(9);ER$(0);:FOR TM=1 TO 500:NEXT TM:NEXT X:GOTO302
1000 REM- INSTRUCTIONS
1005 POKE 53281,1
1010 PRINTCL$;LEFT$(DO$,3);TAB(13);H2$;:PRINT:PRINT
1020 PRINT" [208]REPARE TO TEST YOUR PUZZLER'S":PRINT
1030 PRINT" SKILLS. [197]IGHT WHITE CHECKERS AND":PRINT
1040 PRINT" EIGHT BLACK CHECKERS ARE POSITIONED":PRINT
1050 PRINT" ON OPPOSITE SIDES OF THE CHECKERBOARD ";:PRINT
1055 PRINT" AS SHOWN:"
1060 ZZ=1:FOR TM=1 TO 2000:NEXT TM:PRINT CL$;UC$;:GOSUB1500:POKE53281,1
1070 PRINTCL$;LEFT$(DO$,3);TAB(13);H2$;:PRINT:PRINT:ZZ=0
1080 PRINT" [217]OUR GOAL IS TO SWITCH THE CHECKERS":PRINT
1090 PRINT" TO THE REVERSE SIDES OF THE BOARD. [193]":PRINT
1100 PRINT" CHECKER CAN BE MOVED TO A [210]ED SQUARE":PRINT
1110 PRINT" OR CAN BE JUMPED OVER ANOTHER PIECE":PRINT
1120 PRINT" TO ANOTHER [210]ED SQUARE. [215]HITE PIECES":PRINT
1130 PRINT" MOVE TO THE [210][201][199][200][212]; [194]LACK CHECKERS":PRINT
1140 PRINT" CAN MOVE ONLY TO THE [204][197][198][212]."
1150 FOR TM=1 TO 3000:NEXT TM
1160 PRINTCL$;LEFT$(DO$,3);TAB(13);LC$;"[195]HECKERS [211]WITCH";:PRINT:PRINT
1170 PRINT" [212]HIS PUZZLE CAN BE SOLVED IN 52":PRINT
1175 PRINT" MOVES.":PRINT:PRINT
1180 PRINT" [200]AVE FUN AND [199]OOD [204]UCK !"
1190 FOR TM=1 TO 2500:NEXT TM
1500 GOSUB11000:FOR X=1 TO 45:B(X)=VAL(MID$(D$,X,1)):C(X)=B(X):NEXT X:F2$=""
1510 MV=0:POKE53281,11:PRINT CL$;UC$;:GOTO302
8000 REM- CONVERT 'FROM-TO' TO POSITION IN STRING
8010 IF H=13 THEN H=3:RETURN
8020 IF H=17 THEN H=7:RETURN
8030 IF H=22 THEN H=11:RETURN
8040 IF H=24 THEN H=13:RETURN
8050 IF H=26 THEN H=15:RETURN
8060 IF H=28 THEN H=17:RETURN
8070 IF H=31 THEN H=19:RETURN
8080 IF H=33 THEN H=21:RETURN
8090 IF H=35 THEN H=23:RETURN
8100 IF H=37 THEN H=25:RETURN
8110 IF H=39 THEN H=27:RETURN
8120 IF H=42 THEN H=29:RETURN
8130 IF H=44 THEN H=31:RETURN
8140 IF H=46 THEN H=33:RETURN
8160 IF H=48 THEN H=35:RETURN
8170 IF H=53 THEN H=39:RETURN
8180 IF H=57 THEN H=43:RETURN
8185 IF H=99 THEN8310
8190 REM- MOVE INVALID
8200 FOR X=1 TO 5
8210 PRINT DO$;TAB(9)ER$(3);:FOR TM=1 TO 500:NEXT TM
8220 PRINT DO$;TAB(9)ER$(0);:FOR TM=1 TO 500:NEXT TM
8230 NEXT X:F2$="":GOTO302
8300 REM- END PUZZLE MESSAGE
8310 PRINT DO$;TAB(7)EN$;:FOR TM=1 TO 1500:NEXT TM:PRINT CL$:END
10000 REM- BUILD CHARACTER GRAPHICS
10100 WH$=CHR$(5):BLK$=CHR$(144):RED$=CHR$(28):YEL$=CHR$(158):CYN$=CHR$(159)
10105 PRP$=CHR$(156):B2LU$=CHR$(31):CL$=CHR$(147)
10110 BC$=CHR$(113):DW$=CHR$(17):UP$=CHR$(145)+CHR$(145)
10115 LF$=CHR$(157)+CHR$(157)+CHR$(157)
10118 FOR X=1 TO 24:DO$=DO$+DW$:NEXT X:DO$=CHR$(19)+DO$
10120 RV$=CHR$(18):RO$=CHR$(146)
10130 LC$=CHR$(14):UC$=CHR$(142)
10200 A$(1)=RV$+RED$+" "+RO$+DW$+LF$+RV$+RED$+" "+RO$+WH$+BC$+RV$+RED$+" "+RO$
10210 A$(1)=A$(1)+DW$+LF$+RV$+RED$+" "+RO$
10220 A$(2)=RV$+RED$+" "+RO$+DW$+LF$+RV$+RED$+" "+RO$+BL$+BC$+RV$+RED$+" "+RO$
10230 A$(2)=A$(2)+DW$+LF$+RV$+RED$+" "+RO$
10240 A$(3)=RV$+WH$+" "+RO$+DW$+LF$+RV$+WH$+" "+RO$
10250 A$(3)=A$(3)+DW$+LF$+RV$+WH$+" "+RO$
10260 A$(4)=RV$+RED$+" "+RO$+DW$+LF$+RV$+RED$+" "+RO$
10270 A$(4)=A$(4)+DW$+LF$+RV$+RED$+" "+RO$
10275 CR$=RV$+YEL$+" "+RO$
10280 HDG$=RV$+YEL$+"CHECKERS SWITCH"+RO$
10285 H2$=LC$+B2$+"[195]HECKERS [211]WITCH"
10290 F3$=RV$+CYN$+"FROM ?"+RO$:T3$=RV$+CYN$+"TO ?"+RO$
10300 MV$=RV$+PRP$+"MOVE #"+RO$
10305 REM- ERRORS
10310 ER$(1)=RV$+YEL$+"'FROM' POSITION EMPTY"+RO$
10320 ER$(2)=RV$+YEL$+"'TO' POSITION OCCUPIED"+RO$
10330 ER$(3)=RV$+YEL$+"INVALID 'FROM-TO' POSITION"+RO$
10340 ER$(4)=RV$+YEL$+"MOVE NOT DIAGONAL"+RO$
10350 ER$(5)=RV$+YEL$+"INVALID MOVE"+RO$
10400 ER$(0)=" "
10405 REM- END PUZZLE MESSAGE
10410 EN$=RV$+WH$+"THANKS FOR PLAYING. 'BYE."+RO$
10415 REM- PUZZLE SOLVED !
10420 WIN$=RV$+WH$+"YOU SOLVED THE PUZZLE !"+RO$
10430 REM- SOUND PARAMETERS
10440 VO=54296:WV=54276:AT=54277:HI=54273:LO=54272:F2=0:F2$=""
10500 RETURN
10999 REM- PUZZLE FORMAT
11000 D$="331333233313132323131343232313132323331333233"
11090 REM- PUZZLE SOLVED FORMAT
11100 E$="332333133323231313232343131323231313332333133":RETURN